home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-07-10 | 2.2 KB | 68 lines | [TEXT/CWIE] |
- // =================================================================================
- // CDynamicEditField.cp ©1997 BB's Team inc. All rights reserved
- // =================================================================================
- #include "CDynamicEditField.h"
-
- #include <UTextTraits.h>
- #include <UMemoryMgr.h>
- #include <LString.h>
-
-
- // ---------------------------------------------------------------------------------
- // • Stream ctor
- // ---------------------------------------------------------------------------------
- CDynamicEditField::CDynamicEditField (LStream *inStream)
- : LEditField (inStream)
- {}
-
-
- // ---------------------------------------------------------------------------------
- // • CreateDynamicEditFieldStream [static]
- // ---------------------------------------------------------------------------------
- CDynamicEditField *
- CDynamicEditField::CreateDynamicEditFieldStream (LStream *inStream)
- {
- return new CDynamicEditField (inStream);
- }
-
-
- // ---------------------------------------------------------------------------------
- // • SetFontName (Str255)
- // ---------------------------------------------------------------------------------
- void CDynamicEditField::SetFontName (const Str255 inFontName)
- {
- // Retrieve the present TT (this is made by GetResource underneath)
- TextTraitsH theTTH = UTextTraits::LoadTextTraits (mTextTraitsID);
-
- // Lock it only in the block { }
- {
- StHandleLocker lock ((Handle)theTTH);
-
- // Change the font name
- LString::CopyPStr (inFontName, (**theTTH).fontName);
- (**theTTH).fontNumber = UTextTraits::fontNumber_Unknown;
-
- // Tell UTextTraits to change the TT in TextEdit
- UTextTraits::SetTETextTraits (*theTTH, mTextEditH);
- }
-
- // clean up
- ::ReleaseResource ((Handle)theTTH);
- }
-
-
- // ---------------------------------------------------------------------------------
- // • DontBeTarget (Str255)
- // ---------------------------------------------------------------------------------
- void CDynamicEditField::DontBeTarget()
- {
- /*
- Cannot call protected ancester...
- */
- LEditField::DontBeTarget();
- // StFocusAndClipIfHidden focus(this);
- // ::TEDeactivate(mTextEditH); // Show inactive selection
- // StopIdling(); // Stop flashing the cursor
- ProcessCommand (cmd_LooseFocus, nil);
- }
-